<p>This rule triggers when legacy mathematical expressions are used that can be replaced with modern Math APIs introduced in ES2015.</p>
<h2>Why is this an issue?</h2>
<p>ES2015 introduced many new Math methods that provide clearer, more readable alternatives to complex mathematical expressions. Using these modern
APIs offers several benefits:</p>
<p><strong>Improved readability</strong>: Modern Math methods express mathematical intent more clearly. For example, <code>Math.log10(x)</code>
immediately tells you that you’re calculating a base-10 logarithm, while <code>Math.log(x) / Math.LN10</code> requires mathematical knowledge to
understand.</p>
<p><strong>Better performance</strong>: Native Math methods are typically optimized by JavaScript engines and can perform better than equivalent
manual calculations.</p>
<p><strong>Reduced error potential</strong>: Complex mathematical expressions are more prone to mistakes. Using dedicated methods reduces the chance
of calculation errors.</p>
<p><strong>Standardized approach</strong>: Modern Math APIs provide a consistent way to perform common mathematical operations across different
codebases.</p>
<p>The most common cases involve logarithmic calculations and distance calculations using the Pythagorean theorem, where the intent becomes much
clearer with modern APIs.</p>
<h3>What is the potential impact?</h3>
<p>Using legacy mathematical patterns instead of modern Math APIs reduces code readability and maintainability. Complex expressions are harder to
understand and more error-prone. Performance may also be suboptimal compared to native implementations.</p>
<h3>How to fix?</h3>
<p>Replace Math.log() expressions with Math.log10() for base-10 logarithms.</p>
<h4>Non-compliant code example</h4>
<pre data-diff-id="1" data-diff-type="noncompliant">
const result1 = Math.log(x) * Math.LOG10E; // Noncompliant
const result2 = Math.log(x) / Math.LN10; // Noncompliant
</pre>
<h4>Compliant code example</h4>
<pre data-diff-id="1" data-diff-type="compliant">
const result1 = Math.log10(x);
const result2 = Math.log10(x);
</pre>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://github.com/sindresorhus/eslint-plugin-unicorn#readme">eslint-plugin-unicorn</a> - Rule <a
  href="https://github.com/sindresorhus/eslint-plugin-unicorn/blob/HEAD/docs/rules/prefer-modern-math-apis.md">prefer-modern-math-apis</a> </li>
  <li> Math.log10() - MDN - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log10">Documentation for
  the Math.log10() method</a> </li>
  <li> Math.log2() - MDN - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2">Documentation for the
  Math.log2() method</a> </li>
  <li> Math.hypot() - MDN - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot">Documentation for
  the Math.hypot() method</a> </li>
  <li> Math object - MDN - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math">Complete reference for
  JavaScript Math object and its methods</a> </li>
</ul>
